package teacher.flower;

import java.util.Scanner;

/*
     鲜花销售系统首页
 */
public class FlowerIndex {
    // 准备一个键盘输入对象
    public static final Scanner INPUT = new Scanner(System.in);
    // 准备一个存订单对象的数组
    public static final FlowerOrder[] orderList = new FlowerOrder[5];
    //准备一个操作对象
    public static final FlowerServiceImpl serviceImpl = new FlowerServiceImpl();
    // 让第一开始就初始化5条数据存入数组中
    static {
        orderList[0] = new FlowerOrder("1001","金色海岸-香槟玫瑰",10,318.0,"2016-12-12","胡培元","");
        orderList[1] = new FlowerOrder("1002","初心永不变-白玫瑰",99,538.0,"2016-12-20","张发荣","");
        orderList[2] = new FlowerOrder("1003","梦里花开-紫色桔梗",40,148.0,"2016-12-24","愿意梦","烟波...");
        orderList[3] = new FlowerOrder("1004","心花怒放-粉香百合",120,188.0,"2016-12-26","样林峰","内层...");
        orderList[4] = new FlowerOrder("1005","执青春-无声的爱",1000,219.0,"2016-12-18","张秋生","我爱李...");
    }
    public static void main(String[] args) {
        outer:
        while (true) {
            System.out.println("====================欢迎光临\"七彩鲜花\"销售管理系统========================");
            System.out.println("1.查询销售订单");
            System.out.println("2.修改销售订单");
            System.out.println("3.删除销售订单");
            System.out.println("4.系统退出");
            System.out.println("=========================================================================");
            // 键盘输入一个整数：choice   代表4个功能
            System.out.println("请输入您的选择：");
            int choice = FlowerService.INPUT.nextInt();
            // 判断选择的是哪个功能
            switch (choice){
                case 1:
                    // 查询所有订单功能  findAll()
                    serviceImpl.findAll();
                    break;
                case 2:
                    // 修改订单的功能  update()
                    serviceImpl.update();
                    break;
                case 3:
                    // 删除订单的功能  delete()

                    break;
                default:
                    // 系统退出功能 delete()
                    System.err.println("退出系统");
                    break outer;
            }
        }
    }
}
